import { CircleNode, CircleNodeModel, RectNode, RectNodeModel, PolygonNode, PolygonNodeModel } from '@logicflow/core'

// 申请节点
class ApplyNode extends CircleNode {}
class ApplyNodeModel extends CircleNodeModel {
  initNodeData(data: any) {
    super.initNodeData(data)
    this.width = 30
    this.height = 30
    this.radius = 15
  }
}

// 审批节点
class ApproverNode extends RectNode {}
class ApproverNodeModel extends RectNodeModel {
  initNodeData(data: any) {
    super.initNodeData(data)
    this.width = 50
    this.height = 40
    this.radius = 4
  }
}

// 判断节点
class JugementNode extends PolygonNode {}
class JugementNodeModel extends PolygonNodeModel {
  initNodeData(data: any) {
    super.initNodeData(data)
    this.width = 30
    this.height = 30
  }
}

// 结束节点
class FinishNode extends CircleNode {}
class FinishNodeModel extends CircleNodeModel {
  initNodeData(data: any) {
    super.initNodeData(data)
    this.width = 30
    this.height = 30
    this.radius = 15
  }
}

export const approveNodes = [
  {
    type: 'apply',
    label: '申请',
    style: {
      width: '30px',
      height: '30px',
      borderRadius: '15px',
      border: '2px solid #FF6347',
    },
    property: {
      username: '',
      time: '',
      startTime: '',
      endTime: '',
    },
    view: ApplyNode,
    model: ApplyNodeModel
  },
  {
    type: 'approver',
    label: '审批',
    style: {
      width: '50px',
      height: '40px',
      borderRadius: '4px',
      border: '2px solid #3CB371',
    },
    view: ApproverNode,
    model: ApproverNodeModel
  },
  {
    type: 'jugement',
    label: '判断',
    style: {
      width: '30px',
      height: '30px',
      border: '2px solid #6495ED',
      transform: 'rotate(45deg)',
    },
    view: JugementNode,
    model: JugementNodeModel
  },
  {
    type: 'finsh',
    label: '结束',
    style: {
      width: '30px',
      height: '30px',
      borderRadius: '15px',
      border: '2px solid #FF6347',
    },
    view: FinishNode,
    model: FinishNodeModel
  },
] 